treeview: Ensure search popover is properly inserted
authorMatthias Clasen <mclasen@redhat.com>
Sun, 10 May 2020 17:16:52 +0000 (13:16 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 11 May 2020 12:15:55 +0000 (08:15 -0400)
The css tree and the widget tree are not in sync, so we need
to explicitly set the parent of the css node before inserting
the widget, or else we end up with critical warnings and a
non-working popover.

This can be seen in the print dialog, when moving the focus
to the printer list.

gtk/gtktreeview.c

index 2b3b46441cf62e8296c9d23828bc2da408dd4d1a..9858400af64a534b1f1f423ffd3b9e6de90122fb 100644 (file)
@@ -9967,6 +9967,9 @@ gtk_tree_view_ensure_interactive_directory (GtkTreeView *tree_view)
     return;
 
   tree_view->search_popover = gtk_popover_new ();
+  gtk_css_node_insert_after (gtk_widget_get_css_node (GTK_WIDGET (tree_view)),
+                             gtk_widget_get_css_node (tree_view->search_popover),
+                             tree_view->header_node);
   gtk_widget_set_parent (tree_view->search_popover, GTK_WIDGET (tree_view));
   gtk_popover_set_autohide (GTK_POPOVER (tree_view->search_popover), FALSE);